/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2024-05-23
 * Time: 23:50
 */
public class Test5 {
    public static void main(String[] args) {
        String s1 = new String("abc");
        String s2 = new String("ac");
        String s3 = new String("abc");
        String s4 = new String("abcdefgh");
        //s1和s2不同输出字符差值-1
        System.out.println(s1.compareTo(s2));
        //相同输出 0
        System.out.println(s1.compareTo(s3));
        //前k个字符完全相同,s1和s4前3个字符为abc相同,输出长度差值-5
        System.out.println(s1.compareTo(s4));
    }
}
